﻿using System.Drawing;
using System.Drawing.Drawing2D;

namespace CanvasControl.View
{
    public class Appearance
    {
        public Color Color { get; set; }
        public LineAppearance Border { get; private set; }

        public Appearance()
        {
            Color = Color.White;
            Border = new LineAppearance();
        }
    }

    public class LineAppearance
    {
        public Color Color { get; set; }
        public float Width { get; set; }
        public DashStyle DashStyle { get; set; }

        public LineAppearance()
        {
            Color = Color.Black;
            Width = 1f;
            DashStyle = DashStyle.Solid;
        }
    }

    public static class AppearanceExt
    {
        public static Brush CreateBrush(this Appearance appearance)
        {
            return new SolidBrush(appearance.Color);
        }

        public static Pen CreatePen(this LineAppearance appearance)
        {
            return new Pen(appearance.Color) {Width = appearance.Width, DashStyle = appearance.DashStyle};
        }
    }
}